package cn.virens.database.mysql.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;

public interface PlatformMapper {
	@ResultType(Map.class)
	@Select("SELECT TABLE_NAME AS `name`,TABLE_COMMENT AS `comment` FROM information_schema.`TABLES` WHERE TABLE_SCHEMA=#{database}")
	List<Map<String, Object>> showTables(@Param("database") String database);

	@ResultType(Map.class)
	@Select("SELECT COLUMN_NAME AS `name`,COLUMN_DEFAULT AS `default`,IS_NULLABLE AS `isnull`,DATA_TYPE AS `type`,COLUMN_COMMENT AS `comment` FROM information_schema.`COLUMNS` WHERE TABLE_SCHEMA=#{database} AND TABLE_NAME=#{table}")
	List<Map<String, Object>> showColumns(@Param("database") String database, @Param("table") String table);
}
